<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/***
 * 模块：注单列表
 * 开发者：WJC
 * 日期：2017-01-15
 ***/
class Order extends CI_Controller {
	function __construct(){
		parent::__construct();
		$this->load->library('Huashang/user');
		$this->user->checkLogin();
	}
	//载入列表
	public function index(){
		$data['type']=$this->uri->segment(3);
	    $data['auth']=explode(',', $this->input->get('auth'));
		$this->load->view('order/list',$data);
	}
	//获取列表
	public function getlist(){
		$arr=array('total'=>4,'rows'=>array(
			array('id'=>1,'xz'=>'2017-02-09 17:57:47','kithe'=>'8789789','upline'=>'daili001',
			'order_sn'=>'1486719518759229096','username'=>'hgwerr233','type'=>'PC蛋蛋','content'=>'整合@04@12',
			'money'=>'1122.00','rebate'=>'677.00','lucky_price'=>'344.00','result'=>'赢','pc'=>'455'),
			array('id'=>1,'xz'=>'2017-02-09 17:57:47','kithe'=>'201709887766','upline'=>'daili001',
			'order_sn'=>'1486719518759229096','username'=>'hgwerr233','type'=>'广东11选5','content'=>'整合@03@12',
			'money'=>'1122.00','rebate'=>'677.00','lucky_price'=>'544.00','result'=>'赢','pc'=>'344'),
			array('id'=>1,'xz'=>'2017-02-09 17:57:47','kithe'=>'8789789','upline'=>'daili001',
			'order_sn'=>'1486719518759229096','username'=>'hgwerr233','type'=>'北京PK赛车10','content'=>'整合@04@12',
			'money'=>'1122.00','rebate'=>'677.00','lucky_price'=>'644.00','result'=>'赢','pc'=>'122'),
			array('id'=>1,'xz'=>'2017-02-09 17:57:47','kithe'=>'8789789','upline'=>'daili001',
			'order_sn'=>'1486719518759229096','username'=>'hgwerr233','type'=>'PC蛋蛋','content'=>'整合@04@12',
			'money'=>'1122.00','rebate'=>'677.00','lucky_price'=>'744.00','result'=>'赢','pc'=>'322'),
		));
	    echo json_encode($arr);
	}
	//保存
	public function save(){
		$id 		   			= $this -> input -> post('id');
		$row['gg_sort_order'] 	= $this -> input -> post('gg_sort_order');
		if($this -> user -> save($id,$row) && $this -> admin_sh -> add($sh)){
			echo '{"status":"OK","msg":"执行成功"}';
		}else{
			echo '{"status":"ERROR","msg":"执行失败"}';
		}
	}
	//修改
	public function edit(){
		$data['rs']=array_pop($this->user->update());
		$this->load->view('order/edit',$data);
	}
	//删除
	public function del(){
		$this->user->remove();
	}
}